/* 
 * File:   Mesh.h
 * Author: artem
 *
 * Created on November 18, 2011, 11:37 PM
 */

#ifndef MESH_H
#define MESH_H

#include "Common.h"

namespace Resource
{
	struct MeshHead
	{
		struct Head
		{
			uint32_t vcount;
			uint32_t icount;
			uint32_t scount;
			uint32_t vtype;
		} head;
		
		struct Subset
		{
			uint32_t ioffset;
			uint32_t icount;
		} subsets[16];
	};
	
	struct Mesh : MeshHead
	{
		Vertex   *vdata;
		uint32_t *idata;
		
		Mesh(): vdata(NULL), idata(NULL) {}
		Mesh (uint32_t vcount, uint32_t icount)
		{
			vdata = new Vertex[vcount];
			idata = new uint32_t[icount];
		}
		~Mesh() { delete[] vdata; delete[] idata; }
	};
	
	Mesh* loadMesh(const char *name);
}

#endif /* MESH_H */
